package demo.demo02;

public class For {
    public static void main(String[] args) {
        int sum = 0;
        for (int a = 0; a <= 100; a++) {
            if (a % 2 == 0) {
                sum += a;
            }
        }
        System.out.println("1-100偶数和为：" + sum);
        System.out.println("======================");
        for (int i = 0; i < 5; i++) {          //外层控制行
            for (int j = 0; j < 6; j++) {      //内层控制列
                System.out.print(i + "\t");
            }
            System.out.println();
        }
        System.out.println("======================");
        for (int b = 1; b <= 9; b++) {
            for (int c = 1; c <= b; c++) {
                System.out.print(c + "x" + b + "=" + (c * b) + "\t");
            }
            System.out.println();
        }
        System.out.println("======================");
        for (int d = 9; d >= 1; d--) {
            for (int e = 1; e <= d; e++) {
                System.out.print(e + "x" + d + "=" + (d * e) + "\t");
            }
            System.out.println();
        }
        System.out.println("======================");
        for (int f = 1; f <= 5; f++) {
            for (int g = 1; g <= 5; g++) {
                System.out.print("*\t");
            }
            System.out.println();
        }
        System.out.println("======================");

        for (int h = 1; h <= 5; h++) {
            for (int j = 1; j <= 5; j++) {
                if ((h + j) % 2 == 0) {
                    System.out.print("*\t");
                } else if ((h + j) % 2 == 1) {
                    System.out.print("#\t");
                }
            }
            System.out.println();
        }
        System.out.println("======================");

        int k = 0;
        for (int l = 100; l <= 150; l++) {
            if (l % 3 != 0) {
                k++;
                System.out.print(l + "、\t");
            }
            if (k % 5 == 0) {
                System.out.println();
            }
        }
        System.out.print("\n共打印：" + k + "次！！！");

        System.out.println("======================");
//打印100-150之间的素数\质数(带标签的continue)
        outer:
        for (int m = 101; m < 150; m++) {
            for (int n = 2; n < m / 2; n++) {
                if (m % n == 0) {
                    continue outer;//从内部直接跳转到外部
                }
            }
            System.out.println(m);
        }
    }
}